package cn.stylefeng.guns.modular.storage.service;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.basic.entity.BasicCustomer;
import cn.stylefeng.guns.modular.order.entity.OutOrder;
import cn.stylefeng.guns.modular.storage.entity.StorageOutDetailed;
import cn.stylefeng.guns.modular.storage.model.params.StorageOutDetailedParam;
import cn.stylefeng.guns.modular.storage.model.params.StorageOutParam;
import cn.stylefeng.guns.modular.storage.model.params.StorageStockParam;
import cn.stylefeng.guns.modular.storage.model.result.StorageOutDetailedResult;
import cn.stylefeng.guns.modular.storage.model.result.StorageOutResult;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;
import java.util.List;

import org.apache.poi.ss.usermodel.Workbook;

/**
 * <p>
 * 拣货单明细表 服务类
 * </p>
 *
 * @author hu
 * @since 2019-07-15
 */
public interface StorageOutDetailedService extends IService<StorageOutDetailed> {

    /**
     * 新增
     *
     * @author hu
     * @Date 2019-07-15
     */
    void add(StorageOutDetailedParam param);

    /**
     * 删除
     *
     * @author hu
     * @Date 2019-07-15
     */
    void delete(StorageOutDetailedParam param);

    /**
     * 更新
     *
     * @author hu
     * @Date 2019-07-15
     */
    void update(StorageOutDetailedParam param);

    /**
     * 查询单条数据，Specification模式
     *
     * @author hu
     * @Date 2019-07-15
     */
    StorageOutDetailedResult findBySpec(StorageOutDetailedParam param);

    /**
     * 查询列表，Specification模式
     *
     * @author hu
     * @Date 2019-07-15
     */
    List<StorageOutDetailedResult> findListBySpec(StorageOutDetailedParam param);

    List<StorageOutDetailedResult> findExportToExcelBySpec(StorageOutDetailedParam param,Long operateId);
    
    /**
     * 查询列表，Specification模式
     *
     * @author hu
     * @Date 2019-07-15
     */
    List<StorageOutDetailedResult> sumfindListBySpec(StorageOutDetailedParam param);

    /**
     * 查询分页数据，Specification模式
     *
     * @author hu
     * @Date 2019-07-15
     */
    LayuiPageInfo findPageBySpec(StorageOutDetailedParam param, String condition);

    /**
     * 生成出单
     *
     * @param outOrder
     * @return
     */
    ResponseData outSingle(OutOrder outOrder, ResponseData data);
	/**
     * 生成出单
     *
     * @param outOrder
     * @return
	 * @author stylefeng
	 *
	 * @Date 2019-08-22
	 *
	 */
    ResponseData outSingleHSHN(OutOrder outOrder, ResponseData data);


    ResponseData checkStock(OutOrder outOrder, ResponseData data);

    /**
     * 去重商品
     *
     * @param storageOutDetailedParam
     * @return
     */
    LayuiPageInfo findDistinctGoods(StorageOutDetailedParam storageOutDetailedParam);

    boolean saveBatchList(List<StorageOutDetailed> list);

    /**
     * 批量更新
     *
     * @param detailedList
     * @return
     */
    boolean updateBatchList(List<StorageOutDetailed> detailedList);

    /**
     * app查询商品列表
     */
    List<StorageOutDetailedResult> findBystorageOutNumber(String[] storageOutNumbers);

    /**
     * app查询商品批次列表
     */
    List<StorageOutDetailedResult> findBatchstock(String[] storageOutNumbers, Long goodsid);

    /**
     *出库审核拣货单按库位查询商品
     * @return
     */
    LayuiPageInfo findByapporderReview(String[] storageOutNumbers);


    LayuiPageInfo findByStorageOutNumbersPage(String storageOutNumbers);

    /**
     * 查询拣货单商品托盘信息
     *
     * @param storageOutNumbers
     * @param goodsid
     * @param storagePostionNumber
     * @return
     */
    List<StorageOutDetailedResult> findByTrayList(String[] storageOutNumbers, Long goodsid, String storagePostionNumber);


    /**
     * 出库审核查询拣货单商品托盘信息
     *
     * @return
     */
    List<StorageOutDetailedResult> findByTrayListReview(String[] storageOutNumbers, Long goodsid);

    List<StorageOutDetailedResult> findName(Long deptId , Long deliverId);

    List<StorageOutDetailedResult> findGoodsByName(Long deptId , Long deliverId,StorageOutDetailedParam storageoutdetailedparam);

    List<StorageOutDetailedResult> findBysON(String  storageOutNumber);

    /**
     * 查询合单商品明细或者未合单商品明细详情
     * @param storageOutParam
     * @param condition
     * @return
     */
    LayuiPageInfo findByMark(StorageOutParam storageOutParam, String condition);

    /**
     * 拣货单打印  
     * 查询拣货单明细
     * @author zhucx
     * @Date 2019-09-7
     */
	List<StorageOutDetailedResult> getPrintstorageOutDetailed(StorageOutDetailedParam storageOutDetailedParam);

    List<StorageOutDetailedResult> trayInformation(StorageOutDetailedParam storageOutDetailedParam,String[] strs);

    ResponseData  recommend(List<StorageOutResult> list);

    ResponseData restore(StorageOutParam storageOutParam2, ResponseData data);
    
    int deletebyids(List<Long> list);

    void  unlockTheItem();
    
    /**
     * 检验库存是否完整
     */
    List<StorageOutDetailedResult> complete(StorageOutDetailedResult storageOutDetailedResult);

    //查询库位的数量
    String findnumberOfLocation(String[] storagePostionNumber,String storageGoodscode, String storageOutNumber);

	List<StorageOutDetailedResult> findalreadyListBySpec(StorageOutDetailedParam param,String[] strs);

	StorageOutDetailedResult findSumBySpec(StorageOutDetailedParam param, Long outStorehouseId);

	List<StorageOutDetailedResult> findListBymaekSpec(StorageOutDetailedParam param, String mark);

	List<StorageOutDetailedResult> findTotalalready(StorageOutDetailedParam detailedParam);

	void deleteBySpec(StorageOutDetailedParam detailedParam);

	void updateBySpec(StorageOutDetailedParam param);

	void unlockTheItemNew(User user);

	List<StorageOutDetailedResult> findByStorageOutNumbersPageNew(String[] strs);

	List<StorageOutDetailedResult> completeNew(StorageOutDetailedResult storageOutDetailedResult, User user);

	StorageOutDetailedResult monthOutCount(StorageOutDetailedParam storageOutDetailedParam, Long warehouseId);

	List<StorageOutDetailedResult> monthOutGoodsCount(StorageOutDetailedParam storageOutDetailedParam,
			Long warehouseId);

	List<StorageOutDetailedResult> appMonthJianxuanCount(StorageOutDetailedParam storageOutDetailedParam,
			Long warehouseId);

	List<StorageOutDetailedResult> wmsData(StorageOutDetailedParam storageOutDetailedParam, Long warehouseId);

	StorageOutDetailedResult sumByStockId(StorageOutDetailedParam param);

	StorageOutDetailedResult sumCountAndYijianshu(String[] strs);

	LayuiPageInfo findPageBySpecChukujilu(StorageOutDetailedParam storageOutDetailedParam, String condition,
			Long outStorehouseId, Long deptId, Long deliverId,Long operateId);

	List<StorageOutDetailedResult> findjianxuanzuoyehuizong(StorageOutDetailedParam storageOutDetailedParam,
			String condition, Long outStorehouseId, Long deptId, Long deliverId,Long operateId);

	List<StorageOutDetailedResult> findjianxuanzuoyehuizongRi(StorageOutDetailedParam storageOutDetailedParam,
			String condition, Long outStorehouseId, Long deptId, Long deliverId,Long operateId);

	List<StorageOutDetailedResult> findhuopinchukulianghuizong(StorageOutDetailedParam storageOutDetailedParam,
			String condition, Long outStorehouseId, Long deptId, Long deliverId,Long operateId);

	/**
	 * 通过单号 查询所有商品
	 * @param storageOutDetailedParam
	 * @param strs
	 * @return
	 */
	List<StorageOutDetailedResult> findgoodsbystrs(StorageOutDetailedParam storageOutDetailedParam, String[] strs);

	List<StorageOutDetailedResult> findListStockIdBySpec(StorageOutDetailedParam param);

	StorageOutDetailedResult sumByStockId2(StorageOutDetailedParam detailedParam2, String mark);

	List<StorageOutDetailedResult> trayInformationNew(StorageOutDetailedParam storageOutDetailedParam, String[] strs);

	List<StorageOutDetailedResult> findByStorageOutNumbersPageNewS(StorageOutDetailedParam param2, String[] strs);

	List<StorageOutDetailedResult> trayInformationNewBymark(StorageOutDetailedParam param3, String[] strs);

	List<StorageOutDetailedResult> findListBySpecandstrs(StorageOutDetailedParam param2, String[] strs);

	StorageOutDetailedResult sumBySpecandstrs(StorageOutDetailedParam param2, String[] strs);

	StorageOutDetailedResult findtrayInformationNewBymark(StorageOutDetailedParam param3, String[] strs);

	List<StorageOutDetailedResult> findByStorageOutNumbersPageNewexamine(String[] strs);

	List<StorageOutDetailedResult> trayInformationNewBymarkexamine(StorageOutDetailedParam param3, String[] strs);

	List<StorageOutDetailedResult> trayInformationNewexamine(StorageOutDetailedParam param3, String[] strs);

	List<StorageOutDetailedResult> findjianhuomingxi(StorageOutDetailedParam storageOutDetailedParam, String[] strs);

	List<StorageOutDetailedResult> findjianhuomingxiBymake(StorageOutDetailedParam storageOutDetailedParam,
			String[] strs);

	List<StorageOutDetailedResult> findjianhuomingxiBymakeexamine(StorageOutDetailedParam storageOutDetailedParam,
			String[] strs);

	List<StorageOutDetailedResult> findjianhuomingxiexamine(StorageOutDetailedParam storageOutDetailedParam,
			String[] strs);

	ResponseData confirmpickingbatch(List<StorageOutDetailedResult> list,User user);

	ResponseData confirmpicking(StorageOutDetailedParam param, String num);

	ResponseData zhidingpicking(StorageStockParam sp, BigDecimal numinpt, StorageOutDetailed storageOutDetailed,User user,StorageOutResult outResult);

	ResponseData confirmpickingmake(StorageOutDetailedParam param, String num);

	ResponseData batchoutmake(List<StorageOutDetailedResult> list, User user,StorageOutDetailedParam param);

	ResponseData zhidingpickingmark(StorageStockParam sp, BigDecimal numinpt, StorageOutDetailedParam param, User user,String storageOutNumber);

	StorageOutDetailedResult sumOutByDay(StorageOutDetailedParam outDetailedParam,Long customerId, Long warehouseId);

	ResponseData updatePostionNumber(StorageOutDetailedParam param);

	Workbook exportToExcel(StorageOutDetailedParam storageOutDetailedParam);

	ResponseData checkJhwStock(OutOrder outOrder, ResponseData data);

	ResponseData outSingleWhHSHN(OutOrder outOrder, ResponseData data);

	ResponseData allocateGoods(StorageOutDetailedParam param, String num);

	List<StorageOutDetailedResult> tojianhuo(String goodNo, String storageOutNumber);

    List<String> getkddByOrder(String storageOutNumber);

	List<StorageOutDetailedResult> findByStorageOutNumbersPageNew2(String[] strs);
}
